#pragma once

#include "export.h"
#include "vec.h"
#include "quat.h"
#include "node.h"
#include <string>
#include <osg/node>
#include <osg/Geode>
#include <osgText/text>

enum TextAlign
{
  LEFT_TOP, LEFT_CENTER, LEFT_BOTTOM, CENTER_TOP,
  CENTER_CENTER, CENTER_BOTTOM, RIGHT_TOP, RIGHT_CENTER,
  RIGHT_BOTTOM, LEFT_BASE_LINE, CENTER_BASE_LINE, RIGHT_BASE_LINE,
  LEFT_BOTTOM_BASE_LINE, CENTER_BOTTOM_BASE_LINE, RIGHT_BOTTOM_BASE_LINE, BASE_LINE = LEFT_BASE_LINE
};

//----------------------------------------------------------------------
class DENG_EXPORT Text : public Node 
//----------------------------------------------------------------------
{
public:
  Text(void)                           : Node() {Init("");};
  Text(std::string text)               : Node() {Init(text);} ;
  Text(Node* parent)                   : Node(parent) {Init("");} ;
  Text(Node* parent, std::string text) : Node(parent) {Init(text);} ;
  virtual ~Text(void);

  virtual void SetPosition( Vec p )                     {SetPosition(p.x,p.y);};
  virtual void SetPosition( float x, float y)           {_text->setPosition(osg::Vec3d(x,y,0));};
  virtual Vec  GetPosition()                            { return _text->getPosition(); };

  virtual void SetText(std::string text)                {_text->setText(text);_text->update();};
//virtual const std::string GetText()                   {return _text->getText();};
  virtual void SetFont(std::string fontname)            {_text->setFont(fontname);_text->update();};      
  virtual void SetFontSize(int size)                    {_text->setCharacterSize(size);_text->update();};      
  virtual int  GetFontSize()                            {return _text->getCharacterHeight();};      
  virtual void SetFontResolution(int size)              {SetFontResolution(size,size);_text->update();};      
  virtual void SetFontResolution(int sizeh, int sizev)  {_text->setFontResolution(sizeh,sizev);};           
  virtual void SetColor(Vec c)                          {_text->setColor(c.GetCol());};      
  virtual Vec  GetColor()                               {return Vec(_text->getColor());};      
  virtual void SetAlign(int a)                          {_text->setAlignment( (osgText::Text::AlignmentType)a);};      
  virtual int  GetAlign()                               {return (int)_text->getAlignment();};
  //virtual void     Move(Vec p); 
  //virtual std::string Repr();

protected:
  void Init(std::string text);

  osg::ref_ptr<osg::Camera>   _cam;
  osg::ref_ptr<osg::Geode>    _geode;
  osg::ref_ptr<osgText::Text> _text;

private:
  // removed API
  virtual bool Load(std::string filename) {return false;};
  virtual bool  AddChild(Node *n) {return false;};
  virtual void  ShowTool(int tool) {};
  virtual void  SetRotation( Quat r ) {};
  virtual void  SetRotation( double a, double x, double y, double z) {};
  virtual void  SetScale( Vec s ) {};
  virtual void  SetScale( float x, float y, float z ) {};
  virtual void  Rotate(Quat q) {};
  virtual void  Rotate( double a, double x, double y, double z) {};
  virtual void  RotateX(float a) {};
  virtual void  RotateY(float a) {};
  virtual void  RotateZ(float a) {};
  virtual void  Scale(Vec s) {};
  virtual void  Scale( float x, float y, float z ) {};
  virtual void  Scale(float s) {};

};


